# pure_python_sum.py
def loop_sum(n):
    total = 0
    for i in range(n):
        total += i
    return total